<!--
 * @Description: Text 
 * @Author: rendc
 * @Date: 2021-09-06 11:38:15
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-06 12:06:26
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Text</title>
</head>

<body>
  <div>hello,world</div>
</body>
<script>
  var div = document.getElementsByTagName("div")[0];
  // console.log(div.innerText);
  // console.log(div.textContent);

  var textNode = document.createTextNode("helloworld");
  console.log(textNode.substringData(0, 5)); // hello
  console.log(textNode); // "hello"
  // console.log(textNode); // "hello"
  // console.log(textNode.splitText(5)); // "world"
  // textNode.replaceData(0, 2, "-"); // "-llo,"
  // textNode.deleteData(0, 2);
  // textNode.insertData(6, "world!")
  // textNode.appendData("world");
  // div.appendChild(textNode);
  // console.log(div.nodeName);
  // console.log();
  // var textNode = div.firstChild;
  // console.log(textNode);
  // console.log(textNode.nodeName);
  // textNode.appendData("!!!!");
  // console.log(div.innerText);
</script>

</html>